<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title><spring:message code="message.lable.LiShiDingDanDetail"/></title>
	<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
    <!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1><spring:message code="message.list.YiWanChengDingDan"/></h1>
        <ol class="breadcrumb">
        	<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li><a href="#"><spring:message code="message.list.DingDanGuanLi"/></a></li>
            <li><a href="#"><spring:message code="message.lable.WoDeDingDan"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.list.YiWanChengDingDan"/></a></li>
        </ol>
    </section>
    
    <section class="content">
		<div class=" box box-success">
            <div class="box-body">
                <div class="input">
                	<div class="textalign1"><spring:message code="message.listForm.tongYongMing"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="drugName"	name="drugName" placeholder="<spring:message code="message.listForm.tongYongMing"/>" />
	                    </div>
                	<div class="textalign1"><spring:message code="message.listForm.yaoPinBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="drugCode"	name="drugCode" placeholder="<spring:message code="message.listForm.yaoPinBianMa"/>" />
	                    </div>
	                <div class="textalign1"><spring:message code="message.listForm.shengChanQiYe"/><spring:message code="message.yanZheng.maoHao"/></div>
	                    <div class="boxinput">
	                    <input type="text" class="textinput" id="compName"	name="compName" placeholder="<spring:message code="message.listForm.shengChanQiYe"/>" />
	                    </div>
	                </div>
	                <div class="input" style="margin-top:3px">
					<div class="textalign1"><spring:message code="message.lable.status"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <select id="orderStatus" class="textinput">
                           	<option value="" ><spring:message code="message.select.option"/></option>
	                        <option value="5"><spring:message code="message.listForm.YiDaoHuo"/></option>
	                        <option value="6"><spring:message code="message.listForm.WeiDaoHuo"/></option>
	                        <option value="3"><spring:message code="message.listForm.WuFaPeiSong"/></option>
                           </select>
                    </div>
                    <div class="textalign1" >
                    <button type="button" onclick="gridSerch();" class="btn btn-success btn-sm" id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                </div>
            </div>
            </div>
        </div>

        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        <div class=" box box-warning bottongroup">
            <button type="button" onclick="window.location.href='${ctx}/purOrderInfo/toHospOderInfoOld.html'" class="btn btn-danger btn-sm"><spring:message code="message.button.getBackSpacing"/></button>
        </div>
    </section>
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
  //绑定回车
    $('#drugName,#drugCode,#compName,#orderStatus').bind('keydown', function(event) {
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#drugName").focus();//加载页面光标在第一个查询框内
    
    
    
    
        $(function () {

        	
        	$("#gridlist").jqGrid({
                url: "${ctx}/purOrderInfo/getHospOderOldDetail.html?orderPackId=${param.orderPackId}",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                shrinkToFit: false,
                height: 255,
                colNames: [
                           'drugId',
                           'orderCode',
                           'orderPackId',
                           '<spring:message code="message.listForm.CaiGouJia"/>',
                           '<spring:message code="message.listForm.CaiGouShuLiang"/>',
                           '<spring:message code="message.listForm.CaiGouJinE"/>',
                           '<spring:message code="message.listForm.PeiSongShuLiang"/>',
                           '<spring:message code="message.listForm.PeiSongJinE"/>',
                           '<spring:message code="message.listForm.PeiSongQiYe"/>',
                           '<spring:message code="message.lable.zhuangTai"/>',
                           '<spring:message code="message.listForm.yaoPinBianMa"/>',
                           '<spring:message code="message.listForm.tongYongMing"/>', 
                           '<spring:message code="message.listForm.jiXing"/>',
                           '<spring:message code="message.listForm.guiGe"/>',
                           '<spring:message code="message.listForm.zhuanHuanXiShu"/>',
                           '<spring:message code="message.listForm.baoZhuangDanWei"/>', 
                           '<spring:message code="message.listForm.caiZhi"/>',
                           '<spring:message code="message.listForm.shengChanQiYe"/>',
                           '<spring:message code="message.listForm.CaiGouXianJia"/>',
                           '<spring:message code="message.listForm.GuiDangYuanYin"/>',
                           '<spring:message code="message.listForm.suoShuXiangMu"/>'
                           ],
                colModel: [
					{ name: 'drugId', width:80, hidden:true,align:"center", sortable:false  },  
					{ name: 'orderCode', hidden:true, width: 80, align: "center", sortable:false },
					{ name: 'orderPackId',  hidden:true, width: 80, align: "center", sortable:false },
					{ name: 'proPrice',  width: 80, align: "right" , sortable:false,
                 	   formatter:function(cellvalue, options, row){
                           return formatAmount(cellvalue, options, row);
                       }},
					{ name: 'proCount',  width: 80, align: "center" , sortable:false },
					{ name: 'buyPrice',  width: 80, align: "right", sortable:false,
                 	   formatter:function(cellvalue, options, row){
                           return formatAmount(cellvalue, options, row);
                       }},
					{ name: 'delCount',  width: 80, align: "center", sortable:false },
					{ name: 'delPrice',  width: 80, align: "right", sortable:false,
                 	   formatter:function(cellvalue, options, row){
                            return formatAmount(cellvalue, options, row);
                        }},
					{ name: 'delCompName',  width: 190, align: "center", sortable:false,
						 formatter:function(cellvalue, options,row) {
							 return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.delCompId+"','"+cellvalue+"','${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+row.delCompId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
			     		} },
			     	{ name: 'orderStatus',  width: 80, align: "center", sortable:false },
					{ name: 'drugCode',  width: 100, align: "center", sortable:false,
						formatter:function(cellvalue, options, row) {
							return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.drugId+"','<spring:message code="message.lable.proddruginfoSTDdetail"/>','${ctx}/stdDrug/drugInfoDetail.html?drugId="+row.drugId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>"
                    	}},
					{ name: 'drugName',  width: 140,align:"left", sortable:false },
                    { name: 'formName',  width: 80 , align: "center", sortable:false },
                    { name: 'specName',  width: 80, align: "left", sortable:false  },
                    { name: 'factor',  width: 80, align: "center", sortable:false },
                    { name: 'unit',  width: 40, align: "center", sortable:false },
                    { name: 'materialName',  width: 80, align: "center", sortable:false },
                    { name: 'compName',  width: 180, align: "center" ,  sortable:false,
						 formatter:function(cellvalue, options,row) {
							 return "<a href=\"javascript:$.HN.dialog.opendialog('"+row.compId+"','"+cellvalue+"','${ctx}/stdCompinfo/toStdCompinfoDetail.html?compId="+row.compId+"','800px','400px',function operResult(val){return operResult;})\">"+cellvalue+"</a>";
			     		} },
                    { name: 'proPriceLimit',  width: 80, align: "right", sortable:false},
                    { name: 'archiveType',  width: 130, hidden:true,align: "left", sortable:false},
                    { name: 'projName', hidden:true, width: 130, align: "center", sortable:false }
                ],
                rowNum: 20,
                rowList: [10, 20, 50, 100],
                rownumbers: true,
                pager: "#gridpage",
                //multiselect: true, 
                viewrecords: true,
                gridComplete:function(){
                	//序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                	//数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                caption: "<spring:message code="message.list.DingDanDetailLieBiao"/>",
                jsonReader: {
                    repeatitems: false,
                    id: "ids"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        
        
        
        //查询
        function gridSerch() {
        	var drugCode = $.trim($("#drugCode").val());
        	var drugName = $.trim($("#drugName").val());
        	var compName = $.trim($("#compName").val());
        	var orderStatus = $.trim($("#orderStatus").val());
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json', 
    	        postData:{
    	        		"drugCode":drugCode,
    	        		"drugName":drugName,
    	        		"compName":compName,
						"orderStatus":orderStatus},
    	        		page:1
    	    }).trigger("reloadGrid"); //重新载入  
    	}
        
        
    </script>
</body>
</html>